import { getCurrentInstance, ref } from 'vue'

export function usePopup() {
  const { proxy } = getCurrentInstance()
  
  const showPopup = (options) => {
    return new Promise((resolve) => {
      proxy.$popup.open({
        ...options,
        onConfirm: () => resolve(true),
        onCancel: () => resolve(false)
      })
    })
  }
  
  return {
    showPopup
  }
}